import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TDramaLottery } from "../../../Message/Db/Tables/TDramaLottery";
import { ELotteryShowType } from "../../../Message/Public/ELotteryShowType";
type int = number;
//class DramaLotteryConfig
    
    export  class DramaLotteryConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._strenShowArr = [];
            this._jewelShowArr = [];
            this._elseShowArr = [];
            if (DramaLotteryConfig._instance != null) 
            {
                throw new Error(" DramaLotteryConfig 单例 ");
            }
            this.init();
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_drama_lottery.json");
            this.writeUpdate(loc1);
            return;
        }

        /* internal  */writeUpdate(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TDramaLottery();
                loc1.category = loc2.category;
                loc1.configType = loc2.configType;
                loc1.id = loc2.id;
                loc1.itemCode = loc2.itemCode;
                loc1.newPrice = loc2.newPrice;
                loc1.oldPrice = loc2.oldPrice;
                if (loc1.configType == "LotteryItemShow") 
                {
                    if (loc1.category != ELotteryShowType._ELotteryShowTypeStrength) 
                    {
                        if (loc1.category != ELotteryShowType._ELotteryShowTypeJewel) 
                        {
                            this._elseShowArr.push(loc1);
                        }
                        else 
                        {
                            this._jewelShowArr.push(loc1);
                        }
                    }
                    else 
                    {
                        this._strenShowArr.push(loc1);
                    }
                    continue;
                }
                if (loc1.configType != "LotteryItemConfig") 
                {
                    continue;
                }
                this._map[loc1.id] = loc1;
            }
            return;
        }

        public getStrenShowArr(): Array<any>
        {
            return this._strenShowArr;
        }

        public getJewelShowArr(): Array<any>
        {
            return this._jewelShowArr;
        }

        public getElseShowArr(): Array<any>
        {
            return this._elseShowArr;
        }

        public getLotteryItemById(arg1: int): TDramaLottery
        {
            return this._map[arg1];
        }

        public static get instance(): DramaLotteryConfig
        {
            if (DramaLotteryConfig._instance == null) 
            {
                DramaLotteryConfig._instance = new DramaLotteryConfig();
            }
            return DramaLotteryConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_strenShowArr: Array<any>;

        /* internal */ /* var */_jewelShowArr: Array<any>;

        /* internal */ /* var */_elseShowArr: Array<any>;

        /* internal */ static /* var */_instance: DramaLotteryConfig;
    }
